home *** CD-ROM | disk | FTP | other *** search
/ s-gikan2.maizuru-ct.ac.jp / s-gikan2.maizuru-ct.ac.jp.zip / s-gikan2.maizuru-ct.ac.jp / pub / old / ncvc350_install.exe / {app} / scripts / X_to_2X.pl < prev    next >
Perl Script  |  2004-04-02  |  526b  |  29 lines

  1. #! /usr/bin/perl
  2.  
  3. #  Xì└òWé≡2ö{é╔ò╧è╖é╖éΘâXâNâèâvâg  #
  4.  
  5. $ratio = 2.0;
  6.  
  7. $pre_file= $ARGV[0];
  8. $out_file= $ARGV[1];
  9. open(IN,$pre_file);
  10. open(OUT,">$out_file");
  11.  
  12. while(<IN>){
  13.     if(!/^N?[0-9\s]*[\(\%]/){
  14.         $new_line= "";
  15.         while(/X([\-\d\.]+)/){
  16.             ($pre_line,$num,$_)= ($`,$1,$');
  17.             $num= int(int($num*1000) * $ratio);
  18.             $num= $num/1000;
  19.             if($num !~ /\./ and $num != 0){ $num = $num."\.";}
  20.             $new_line= $new_line.$pre_line."X".$num;
  21.         }
  22.         $_= $new_line.$_;
  23.     }
  24.     print OUT;
  25. }
  26.  
  27. close(OUT);
  28. close(IN);
  29.